package com.scoresystem.web.ui.view;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.scoresystem.model.Score;
import com.scoresystem.model.StuScore;
import com.scoresystem.utils.JsonUtil;

import net.sf.json.JSONObject;
/**
 * 学生查看记录界面
 * @author Administrator
 *
 */
public class ShowStuScoreView implements IShowable {

	@Override
	public void showView(JSONObject json, HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
		response.setHeader("contentType", "text/html; charset=utf-8");
		if(JsonUtil.getState(json).equals("success")){
			List<Score> list=JsonUtil.getScore(json);
			request.setAttribute("list", list);
			request.getRequestDispatcher("/ScoreStuInfo.jsp").forward(request, response);
		}
		else
			request.getRequestDispatcher("/StudentMain.jsp").forward(request, response);
	}

}
